<?php
/**
 * Created by PhpStorm.
 * User: Digvijay
 * Date: 10/19/14
 * Time: 11:12 PM
 */

class About extends MY_Home {
    public function index() {
        $cartDetails = $this->getCartDetails();
        $clientName = $this->isClientLoggedIn();
        $categories = $this->findAll("Category");
        $about = $this->findContentByType(Contents::ABOUT);
        $terms = $this->findContentByType(Contents::CONTENT_TERMS_AND_CONDITION);
        foreach($categories as $category){
            if($category->getParent() == null){
                $noOfSub = 0;
                foreach($categories as $sub){
                    if($sub->getParent() != null && $sub->getParent()->getId() == $category->getId()){
                        $noOfSub++;
                    }
                }
                $category->setNoOfSub($noOfSub);
            }
        }
        $data = array("categories"=>$categories,"user"=>$clientName,"cart"=>$cartDetails, "about"=>$about,"terms"=>$terms);
        $this->load->view('about',$data);
    }
} 